<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace app\models;
use Yii;
/**
 * Description of login
 *
 * @author Administrator
 */
class login extends \yii\db\ActiveRecord implements \yii\web\IdentityInterface{
    //put your code here
    public static function tableName(){
        return 't_user';
    }
    
    public static function findIdentity($userid){
        return static::findOne($userid);
    }
    
    public static function findByUserName($name){
        return static::find()->where(['username'=>$name])->one();
    }
    
    public static function validatePassword($data,$password){
        if($data->password==$password){
            return Yii::$app->user->login($data,3600);
        }
        return false;
    }
    
    public static function findIdentityByAccessToken($token,$type = null){
        return true;
    } 
    
    public function getId() {
        return $this->userid;
    }
    
    public function getAuthKey() {
        return true;
    }
    
    public function validateAuthKey($authKey) {
        return true;
    }
    
    
    
    
    
    
    
    
}
